import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.swing.JComponent;

@SuppressWarnings("serial")
public class RenderableBox extends JComponent{
	
	int boxWidth;
	int boxHeight;
	private BufferedImage theImage;
	boolean verbose;
	
	public RenderableBox(int boxWidth, int boxHeight, boolean verbose) {
		super();
		this.boxWidth = boxWidth;
		this.boxHeight = boxHeight;
		this.verbose = verbose;
		
		theImage = new BufferedImage(this.boxWidth, this.boxHeight, BufferedImage.TYPE_INT_RGB);
		
		if(verbose){
			for(int i=0; i<boxWidth; i++){
				theImage.setRGB(i, 0, Color.green.getRGB());
				theImage.setRGB(i, boxHeight-1, Color.red.getRGB());
			}
		}	
		
		if(verbose){
			for(int i=0; i<boxHeight; i++){
				theImage.setRGB(0, i, Color.blue.getRGB());
				theImage.setRGB(boxWidth-1, i, Color.white.getRGB());
			}
		}	
		
	}
	
	public void setBufferedImage(BufferedImage newImage){
		theImage = newImage;
	}
	
	public BufferedImage getBufferedImage(){
		return theImage;
	}
	
	public void paintComponent(Graphics g) {
		g.drawImage(theImage, 0,0, null);		
	}
	
	public Dimension getPreferredSize() {
		return new Dimension(boxWidth, boxHeight);
	}


}
